package cn.com.elite;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;

import javax.sql.DataSource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dom4j.Document;
import org.dom4j.DocumentFactory;
import org.springframework.jdbc.core.JdbcTemplate;



public class util{
	private static final Log log=LogFactory.getLog(util.class);
	public static String getERRO(Exception e){
		String str="";
		try{
            StringWriter sw=new StringWriter();  
            e.printStackTrace(new PrintWriter(sw,true));  
            str=sw.toString(); 	
		}catch(Exception e1){
			str=e.toString();
			log.error("getERRO:"+e1.toString());
		}
		return str;
	}
	
	public static Document getDoc()throws Exception{
		Document result=DocumentFactory.getInstance().createDocument("utf-8");
		return result;
	}
	  public static String filter(String str) {
		    if (str == null)
		      str = "";
		    if (str.equals("null"))
		      str = "";
		    return str.trim();
		  }	
	public static String getStr(String a){
		if(a!=null){
			return a;
		}else{
			return "";
		}
	}
}
